#include "mainwindow.h"
#include "rpi_sensors.h"

accelerometerWidget::accelerometerWidget(QObject *parent,rpi_sensor_acc *a) {
    setupUi(this);
    acc =a;
    refreshContent();
}

accelerometerWidget::~accelerometerWidget() {

}


void accelerometerWidget::refreshContent() {
    if (!acc) return;
    X->setText(QString("%1").arg(acc->currentxPosition()));
    Y->setText(QString("%1").arg(acc->currentyPosition()));
    Z->setText(QString("%1").arg(acc->currentzPosition()));

    dXdt->setText(QString("%1").arg(acc->currentxVelocity()));
    dYdt->setText(QString("%1").arg(acc->currentyVelocity()));
    dZdt->setText(QString("%1").arg(acc->currentzVelocity()));

    dX2dt->setText(QString("%1").arg(acc->currentxAcceleration()));
    dY2dt->setText(QString("%1").arg(acc->currentyAcceleration()));
    dZ2dt->setText(QString("%1").arg(acc->currentzAcceleration()));

}
